using System;
using System.Collections.Generic;
using UnityEngine;

namespace Features
{

    [CreateAssetMenu(fileName = "Damage", menuName = "Features/范围伤害", order = 7)]
    public class Damage : Feature
    {
        public float damage;
        public override void CancleEffect(FeatureEventArgs args)
        {

        }

        public override void ExecuteEffect(FeatureEventArgs args)
        {
            var position = args.TargetGridNode;
            // 获取距离为1的单元格
            var pawns = GridManager.instance.GetDistancePawn(position);

            foreach (var pawn in pawns)
            {
                if(pawn == args.pawn)
                    continue;
                pawn.BeHit(damage, null);
            }
            SpriteTextManager.NewEffectText("爆炸", args.pawn.transform.position.x, args.pawn.transform.position.y, Color.red);
        }

        public override string GetDescription()
        {
            return GetTriggerText() + "对一格范围内造成" + damage + "伤害";
        }
    }
}